import request from '@/config/axios'

// 获取膳食计划列表
export function getMealPlans(params) {
  return request({
    url: '/meal-plans',
    method: 'get',
    params
  })
}

// 获取膳食计划详情
export function getMealPlanDetail(id) {
  return request({
    url: `/meal-plans/${id}`,
    method: 'get'
  })
}

// 创建膳食计划
export function createMealPlan(data) {
  return request({
    url: '/meal-plans',
    method: 'post',
    data
  })
}

// 更新膳食计划
export function updateMealPlan(id, data) {
  return request({
    url: `/meal-plans/${id}`,
    method: 'put',
    data
  })
}

// 删除膳食计划
export function deleteMealPlan(id) {
  return request({
    url: `/meal-plans/${id}`,
    method: 'delete'
  })
}

// 获取推荐膳食计划
export function getRecommendedPlan() {
  return request({
    url: '/meal-plans/recommend',
    method: 'get'
  })
}

// 获取计划模板列表
export function getPlanTemplates() {
  return request({
    url: '/meal-plans/templates',
    method: 'get'
  })
}

// 保存为模板
export function saveAsTemplate(data) {
  return request({
    url: '/meal-plans/templates',
    method: 'post',
    data
  })
}

// 从模板创建计划
export function createFromTemplate(templateId) {
  return request({
    url: `/meal-plans/templates/${templateId}/create`,
    method: 'post'
  })
} 